dask delayed
From dask
Delayed Best Practices — Dask documentation
https://docs.dask.org/en/latest/delayed-best-practices.html
How to parallelize Python code with Dask Delayed (YouTube)
https://www.youtube.com/watch?v=-EUlNJI2QYs&t=41s
https://github.com/coiled/coiled-resources/blob/master/dask-delayed/delayed.ipynb
Dask Delayed — How to Parallelize Your Python Code With Ease | by Dario Radečić | Towards Data Science
https://towardsdatascience.com/dask-delayed-how-to-parallelize-your-python-code-with-ease-19382e159849
With list comprehension
code:python
@delayed
def function():
....
list = function() for n in range(100)
compute(*list)
With Progress bar
code:python
from dask.distributed import progress,Client
from dask.diagnostics import ProgressBar
client=Client()
client
@delayed
def func(n):
...
results=[]
for n in range(100):
results.append(func(n))
futures = client.compute(results)
progress(futures)
code:python
results=f.result() for f in futures
Tips
When we used dask.delayed without having a distributed scheduler, we are relying on a single-machine scheduler, and dask will use the threadpool executor, which by default will use the resources available on your machine.
You can check this by doing:
code:python
import os
os.cpu_count()